import type { AxiosRequestConfig, AxiosResponse } from 'axios';
import { BusinessCode } from './config';

// 响应数据接口
export interface ResponseData<T = unknown> {
  code: BusinessCode;
  data: T;
  message: string;
}

// 请求配置接口
export interface RequestConfig extends AxiosRequestConfig {
  // 是否显示错误信息
  showError?: boolean;
  // 是否显示成功信息
  showSuccess?: boolean;
  // 成功信息
  successMessage?: string;
  // 错误信息
  errorMessage?: string;
}

// 响应拦截器
export interface ResponseInterceptor {
  onFulfilled?: (response: AxiosResponse<ResponseData>) => AxiosResponse<ResponseData>;
  onRejected?: (error: unknown) => unknown;
}

// 请求拦截器
export interface RequestInterceptor {
  onFulfilled?: (config: RequestConfig) => RequestConfig;
  onRejected?: (error: unknown) => unknown;
} 